<template>
  <div v-loading="loading" class="list-table noPad">
    <el-tabs v-model="activeTab" @tab-click="handleClick">
      <el-tab-pane key="1" :label="$t('全部客户')" :lazy="true" name="1">
        <lpBasesList ref="all" code="all" />
      </el-tab-pane>
      <el-tab-pane key="2" :label="$t('现有客户')" :lazy="true" name="2">
        <lp-base-list ref="now" code="now" />
      </el-tab-pane>
      <el-tab-pane key="3" :label="$t('潜在客户')" :lazy="true" name="3">
        <lp-base-list ref="potential" code="potential" />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>

import LpBaseList from '@/views/fund/lpBase/lpBaseList'
import lpBasesList from '@/views/fund/lpBase/lpBasesList.vue'
export default {
  components: {
    LpBaseList,
    lpBasesList
  },

  data() {
    return {
      loading: false,
      activeTab: '1'
    }
  },
  mounted() {
  },
  methods: {
    handleClick(tab) {
      // 如果是全部客户/潜在用户每次点击从新加载数据 防止其他页面添加不显示
      if (tab.name === '1') {
        if (this.$refs.all?.getList !== undefined) {
          this.$refs.all.getList()
        }
      } else if (tab.name === '3') {
        if (this.$refs.potential?.getList !== undefined) {
          this.$refs.potential.getList()
        }
      } else if (tab.name === '2') {
        if (this.$refs.now?.getList !== undefined) {
          this.$refs.now.getList()
        }
      }
    }
  }
}
</script>
